package com.coolwen.service;


import com.coolwen.entity.Resource;
import com.coolwen.entity.Role;
import com.coolwen.entity.RoleResource;
import com.coolwen.entity.UserRole;

import java.util.List;

/**
 * Created by user on 2016/6/8.
 */
public interface RoleService {

    public void add(Role role);

    public void delete(Integer id);

    public Role load(Integer id);

    public void update(Role role);

    public List<Role> list();


    public UserRole loadUserRole(Integer uid, Integer roleId);

    public void addRoleResource(Integer roleId,Integer resId);


    /**
     * 删除某个用户的所有角色
     *
     * @param uid
     */
    public void deleteUserRoles(Integer uid);

    /**
     * 根据角色id获取可以访问的所有资源
     *
     * @param roleId
     * @return
     */
    public List<Resource> listRoleResource(Integer roleId);


    public int deleteRoleResource(Integer roleId, Integer resId);


}
